package com.ws.universal.tools.utils.glide;


import android.graphics.Color;

import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.ws.universal.tools.ContextInit;


/**
 * Createed by ws on 2019/10/11
 */
public class RequestOptionUtils {

    /*******普通图片加载******/
    public static RequestOptions getRequestOption(int imgLoadError, int imgPlaceho) {
        RequestOptions options = new RequestOptions()
                .error(imgLoadError)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .placeholder(imgPlaceho);
        return options;
    }


    /*******高斯模糊******/
    public static RequestOptions getBlurTransformation(int imgLoadError, int imgPlaceho) {
        RequestOptions options = new RequestOptions()
                .skipMemoryCache(true)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .transforms(new CircleTransform(ContextInit.getContext(), 2, Color.DKGRAY))//外圈宽度，外圈颜色
                .error(imgLoadError)
                .placeholder(imgPlaceho);
        return options;
    }

    /*******黑白******/
    public static RequestOptions getBlackWhiteTransformation(int imgLoadError, int imgPlaceho) {
        RequestOptions options = new RequestOptions()
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .transforms(new BlackWhiteTransformation())
                .error(imgLoadError)
                .placeholder(imgPlaceho);
        return options;
    }
}
